<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="icon" href="{:config('web.cdn')}/favicon.ico">
    <title>在线工具 - 米醋儿</title>
    <meta name="keywords" content="在线小工具，PHP工具，时间戳转换">
    <meta name="description" content="非常时候PHP开发者使用的在线小工具">
    {include file="public:head" /}
</head>
<body>
{include file="public:header_nav" /}
<div class="clear"></div>
<div class="layui-container    mt15 toolspage">


        <div class="fly-panel fly-panel-user tools">
            <div class="layui-tab layui-tab-brief" lay-filter="demo">
                {include file="tools:nav" /}
                <br>
                <br>
                <hr>
                <ul class="layui-tab-title" id="LAY_mine">
                    <li class="layui-this" lay-id="tab1">时间戳</li>
                    <li lay-id="tab2">url编码解码</li>
                    <li lay-id="tab3">md5加密</li>
                    <li lay-id="tab4">base64加密解密[字符串]</li>

                </ul>
                <div class="layui-tab-content" style="padding: 20px 0;">
                    <div class="layui-form layui-form-pane layui-tab-item layui-show">

                            <div class="layui-form-item">
                                <label  class="layui-form-label">时间戳</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="timestamp"   autocomplete="off" value="{:time()}" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    <button class="layui-btn" key="set-mine" onclick="fun1()">></button>
                                    <button class="layui-btn" key="set-mine" onclick="fun2()"><</button>
                                </div>
                                <label  class="layui-form-label">北京时间</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="beijing"  value="{:date('Y-m-d H:i:s',time())}"  class="layui-input">
                                </div>
                            </div>

                    </div>

                    <div class="layui-form layui-form-pane layui-tab-item">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">请输入需要操作的url地址</label>
                            <div class="layui-input-block">
                                <textarea placeholder="随便写些什么刷下存在感"  name="url" autocomplete="off" class="layui-textarea" style="height: 80px;"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn" key="set-mine" onclick="fun3()">编码</button>
                            <button class="layui-btn" key="set-mine" onclick="fun4()">解码</button>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">结果展示</label>
                            <div class="layui-input-block">
                                <textarea placeholder="随便写些什么刷下存在感"  name="urlto" autocomplete="off" class="layui-textarea" style="height: 80px;"></textarea>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form layui-form-pane layui-tab-item">
                        <blockquote class="layui-elem-quote layui-quote-nm">常用值
                            123456-e10adc3949ba59abbe56e057f20f883e

                        </blockquote>

                        <div class="layui-form-item">
                            <label  class="layui-form-label">欲加密</label>
                            <div class="layui-input-inline">
                                <input type="text" name="md"  autocomplete="off" value="" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                                <button class="layui-btn" key="set-mine" onclick="fun5()">转换</button>
                            </div>
                            <label class="layui-form-label">加密后</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="mdto"   class="layui-input">
                            </div>
                        </div>
                    </div>




                </div>

            </div>
        </div>
    </div>


{include file="public/footer"}

<script>
    var tabid = "{:input('get.tabid','tab1')}";
    layui.use('element', function(){
        var element = layui.element;

        //一些事件监听
        element.on('tab(demo)', function(data){
            console.log(data);
        });
        //tab定位
        element.tabChange('demo', tabid);
    });
    function get_stamp_now(){
        var date = new Date();
        var stamp_now = date.getTime()+"";
        stamp_now =  stamp_now.substr(0,10);
        $("input[name=timestamp]").val(stamp_now);
    }
    //var auto1 = setInterval("get_stamp_now()","1000");

    //时间戳转换为背景时间按钮
    function fun1(){
        var t = $("input[name=timestamp]").val();
        var url = "{:url('tools/timestamp')}";
        $.post(url,{t:t},function (e) {
            $("input[name=beijing]").val(e);
        })
    }

    function fun2(){
        var t = $("input[name=beijing]").val();
        var url = "{:url('tools/beijing')}";
        $.post(url,{t:t},function (e) {
            $("input[name=timestamp]").val(e);
        })
    }

    //url 编码
    function fun3() {
        var t = $("textarea[name=url]").val();
        var url = "{:url('tools/en_url')}";
        $.post(url,{t:t},function (e) {
            $("textarea[name=urlto]").val(e);
        })
    }

    function fun4() {
        var t = $("textarea[name=url]").val();
        var url = "{:url('tools/de_url')}";
        $.post(url,{t:t},function (e) {
            $("textarea[name=urlto]").val(e);
        })
    }

    function fun5(){
        var t = $("input[name=md]").val();
        var url = "{:url('tools/md')}";
        $.post(url,{t:t},function (e) {
            $("input[name=mdto]").val(e);
        })
    }

</script>
